<?php
$this->headTitle($this->translator('message_view'));
?>
<div class="grid_8 alpha ">
<?php
    $arrParamMessage = array(
        'enterprise_id'   => $this->enterprise->id,
        'enterprise_name' => Tomato_Utility_String::removeSign($this->enterprise->company_name_en, '-', true)
    );
	$class_to       = ($this->message->fromenterprise_id != $this->enterprise->id)? "selected" : null;
	$class_from     = ($this->message->fromenterprise_id == $this->enterprise->id)? "selected" : null;
?>
<ul class="tabNavigation">
	<li><a class="<?php echo $class_to;?>" href="<?php echo $this->url($arrParamMessage, 'bizprofile_message_inbox'); ?>"><?php echo $this->translator('message_breakcrumb_indox');?></a></li>
	<li><a class="<?php echo $class_from;?>" href="<?php echo $this->url($arrParamMessage, 'bizprofile_message_send'); ?>"><?php echo $this->translator('message_breakcrumb_outbox');?></a></li>
</ul> 
</div>
<?php if ($this->message) : ?>
<div class="grid_8 alpha">
    <?php
        $arrEnterprise = unserialize($this->message->toenterprisearray); // Enterprise receive message
        $arrParamReply = array(
            'enterprise_id' => $arrEnterprise['enterprise_id'],
            'enterprise_name' => Tomato_Utility_String::removeSign($arrEnterprise['company_name_vn'], '-', true),
            'reply_id' => $this->message->fromenterprise_id
        );

        /**
        * Enterprise follow message to view
        **/
        $arrRouteEnterprise = array(
            'enterprise_id' => $this->arrEnInfo['e_id'],
            'enterprise_name' => Tomato_Utility_String::removeSign($this->arrEnInfo['e_name'], '-', true)
        );
		        
        $arrDeleteMessage = array(
            'enterprise_id' => $this->enterprise->id,
            'enterprise_name' => Tomato_Utility_String::removeSign($this->enterprise->company_name_en, '-', true),
            'message_id' => $this->message->id
        );
        
        $arrEnt_receive_message = array(
            'enterprise_id' => $arrEnterprise['enterprise_id'],
            'enterprise_name' => Tomato_Utility_String::removeSign($arrEnterprise['company_name_vn'], '-', true)
        );
        
    ?>
    <div class="title grid_7 alpha" ><?php echo $this->translator('message_detail_subject');?>: <?php echo $this->message->title; ?></div>
	<div class="grid_1 omega" style="width: 80px; text-align: right;">	
		<?php if($this->message->fromenterprise_id != 0): // Nguoi gui la Enterprise ?>
		<a href="<?php echo $this->url($arrParamReply, 'bizprofile_message_add'); ?>"><?php echo $this->translator('message_action_reply');?></a> 			|
		<?php endif;?>
		<a onclick="return confirm('<?php echo $this->translator('message_delete_confirm');?>');" 
			href="<?php echo $this->url($arrDeleteMessage, 'bizprofile_message_delete'); ?>">
			<?php echo $this->translator('message_action_delete');?>
		</a>
	</div>
	<style>
		.row .label_L{
			float: left;
			width: 100px;
			text-align: left;
			display: block;
			margin-right: 20px;
			height: 20px;
			line-height: 26px;		
		}
		.row .label_R{
			float: left;
			text-align: left;
			display: block;
			margin-right: 20px;
			height: 20px;
			line-height: 26px;		
		}
	</style>
    <div class="grid_8 alpha row">
		<label class="label_L"><?php echo $this->translator('message_detail_from_user');?></label>
		<label class="label_R">: <?php echo $this->message->fromuser_name; ?></label>
	</div>	
	<?php if($this->message->fromenterprise_name != ""):?>
	<div class="grid_8 alpha row">
		<label class="label_L"><?php echo $this->translator('message_detail_from_enterprise')?></label>
		<label class="label_R">: <a href="<?php echo $this->url($arrRouteEnterprise, 'bizprofile_enterprise_index'); ?>"><?php echo $this->message->fromenterprise_name; ?></a></label>
	</div>
	<?php endif;?>
    <div class="grid_8 alpha row">
		<label class="label_L"><?php echo $this->translator('message_caption_to')?>:</label>
		<label class="label_R">: <a href="<?php echo $this->url($arrEnt_receive_message, 'bizprofile_enterprise_index'); ?>"><?php echo $arrEnterprise['company_name_vn']; ?></a></label>
	</div>
	<div class="grid_8 alpha row">
        <label class="label_L"><?php echo $this->translator('message_detail_date')?></label>
		<label class="label_R">: <?php echo date('d/m/Y', $this->message->dateline_send); ?></label>
    </div>
    <div class="grid_8 alpha row" style="background: none repeat scroll 0 0 #BCBBB9;font-weight: bold;height: 26px;color:white; vertical-align: middle;display:table-cell; padding-left: 8px;">
        <label class="label_L"><?php echo $this->translator('message_detail_content')?></label>
    </div>
	<div class="grid_8 t_a_bottom">
		 <?php echo $this->message->message; ?>
	</div>
</div>
<?php else : ?>
<div class="grid_8 t_a_bottom">
    <?php echo $this->translator('message_not_exists'); ?>
</div>
<?php endif; ?>
